﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Drawing;

namespace Vit.Report.XmlWebReport
{
    public class TableHeaderElement : CellElement
    {
        private TableElement table;

        public TableHeaderElement(TableElement table, string topLeftPosition, string bottomRightPosition, string columnName, string content)
            : base(table.Page, topLeftPosition, bottomRightPosition, content)
        {
            this.table = table;
            this.ColumnName = columnName;
            this.table.Headers.Add(this);
            HeaderIndex = this.table.Headers.Count;
            Index = HeaderIndex;
        }

        public TableHeaderElement(TableElement table, RectanglePosition rect, string columnName, string content)
            : base(table.Page, rect, content)
        {
            this.table = table;
            this.ColumnName = columnName;
            this.table.Headers.Add(this);
            HeaderIndex = this.table.Headers.Count;
            Index = HeaderIndex;
        }

        protected override void Initialize()
        {
            base.Initialize();
            IsVirtual = false;
            PositionType = PositionType.Fix;
            this.CssClass += " table-header";
        }

        protected override void AddToPage()
        {
        }

        public string ColumnName { get; set; }
        public string CellCssClass { get; set; }
        public string CellCssStyle { get; set; }
        public Font CellFont { get; set; }
        public bool IsVirtual { get; set; }
        public int HeaderIndex { get; set; }
        public TableElement Table { get { return table; } }
    }
}
